package com.yfg.wap.flight.web;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.yfg.wap.flight.dao.GetRegionData;
import com.yfg.wap.flight.entity.base.RegionData;

import net.sf.json.JSONArray;

public class GetRegionAction {
	
	public String get() throws IOException{
		HttpServletRequest request = ServletActionContext.getRequest();
		String parentId = request.getParameter("pid");
		String regionType = request.getParameter("rt");
		GetRegionData grd = new GetRegionData();
		List<RegionData> list = grd.getRegionDatas(Integer.valueOf(parentId), Integer.valueOf(regionType));
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("UTF-8");
		response.getWriter().print(JSONArray.fromObject(list).toString());
		return null;
	}
}
